<template>
  <view class="news-detail-container">
    <view class="news-detail-header">
      <view class="header-title">{{ newsDetail.name }}</view>
    </view>
	<p class="time">{{ newsDetail.create_time }}</p>
<!--    <view class="news-detail-image">
      <image :src="newsDetail.image" mode="widthFix"></image>
    </view> -->
    <view class="news-detail-content">
		<rich-text :nodes="newsDetail.content"></rich-text>
      <!-- <view class="news-content-text">{{ newsDetail.content }}</view> -->
    </view>
  </view>
</template>

<script>
import {
	request
} from '@/utils/request.js'
export default {
  data() {
    return {
      newsDetail: {}
    };
  },
  onLoad(options) {
	  console.log(options)
    const id = options.id;
	if(options.type==1){
		this.getInfo2(id)
	}else{
		this.getInfo(id)
	}
  },
  methods:{
	  async getInfo(id){
		  console.log(222222)
		  try{
		  	const  res = await request({
					url: 'index/notice-view',
					method: 'get',
					data: {
						id:id
					}
				})
				console.log(res)
				if(res.status==200){
					console.log(res.data)
					this.newsDetail = res.data
				}
		  }catch(e){
		  	//TODO handle the exception
		  }
	  },
	  async getInfo2(id){
	  		  console.log(222222)
	  		  try{
	  		  	const  res = await request({
	  					url: 'index/feedback-view',
	  					method: 'get',
	  					data: {
	  						id:id
	  					}
	  				})
	  				console.log(res)
	  				if(res.status==200){
	  					console.log(res.data)
	  					this.newsDetail = res.data
	  				}
	  		  }catch(e){
	  		  	//TODO handle the exception
	  		  }
	  }
  }
};
</script>

<style>
	page{
		/* background-color: #f2f2f2; */
	}
.news-detail-container {
  padding: 20rpx;
  /* background-color: #f5f5f5; */
}
.news-detail-header {
  text-align: center;
  margin-bottom: 20rpx;
}
.header-title {
  font-size: 36rpx;
  font-weight: bold;
  color: #333;
}
.news-detail-image {
  width: 100%;
  margin-bottom: 20rpx;
}
.news-detail-image image {
  width: 100%;
}
.news-detail-content {
  font-size: 30rpx;
  line-height: 1.6;
  color: #333;
}
.news-content-text {
  white-space: pre-line;
}
.time{
	margin-bottom: 30rpx;
	text-align: center;
	font-size: 26rpx;
	color: #666;
}
</style>